import { request } from '@pkg/request/src';

export enum Api {
  page = '/userGoods/page',
  remove = '/userGoods/remove',
  getTiyanVipcardList = '/vipcard/getTiyanVipcardList',
  frozenSub = '/userGoods/frozenSub',
  isExistByVipCardNo = '/userGoods/isExistByVipCardNo',
}

export enum employeeGiveGoodsApi {
  addTiyanVipCard = '/employeeGiveGoods/addTiyanVipCard',
}

export const getTiYanVipcardList = params =>
  request.get(
    {
      url: Api.getTiyanVipcardList,
      params: params,
    },
    { errorMessageMode: 'none', successMessageMode: 'none' },
  );

export const addTiyanVipCard = params =>
  request.post(
    {
      url: employeeGiveGoodsApi.addTiyanVipCard,
      params: params,
    },
    { errorMessageMode: 'message', successMessageMode: 'none' },
  );

export const frozenSub = params =>
  request.post(
    {
      url: Api.frozenSub,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
export const existByVipCardNo = (vipCardNo: string) =>
  request.post({
    url: Api.isExistByVipCardNo,
    params: { vipCardNo: vipCardNo },
  });
